<?php


namespace app\api\model\integral;

use app\common\model\integral\CommentImage as CommentImageModel;

class CommentImage extends CommentImageModel
{
    public static function saveAllImages($commentList, $formData)
    {
        // 生成评价图片数据
        $imageData = [];
        foreach ($commentList as $comment) {
            $item = $formData[$comment['order_goods_id']];
            foreach ($item['uploaded'] as $imageId) {
                $imageData[] = [
                    'comment_id' => $comment['comment_id'],
                    'image_id' => $imageId,
                    'wxapp_id' => self::$wxapp_id
                ];
            }
        }
        return self::insertAll($imageData);
    }
}